<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        
    </style>
</head>
<body>
    
</body>
<script>
    
    const Obj = {
        getBanner:function(){
            return "获取到了轮播图数据";
        },
        getGoods:function(){
            return "获取到了商品数据";
        },
        getMenu:function(){
            return "获取到了菜单数据";
        },
        getUser:function(){
            return "获取到了用户信息"
        }
    }

    function getData(type){
        return Obj[type]();
    }

    console.log(getData("getBanner"))
    console.log(getData("getUser"))
    console.log(getData("getMenu"))

</script>
</html>